package com.api.client.imp;

import org.scribe.builder.api.Api;
import org.scribe.builder.api.DefaultApi10a;
import org.scribe.model.OAuthConfig;
import org.scribe.model.OAuthRequest;
import org.scribe.model.Token;
import org.scribe.oauth.OAuthService;

public class OAuthSignerImp implements OAuthSigner{

	private final OAuthService service;
	
	public OAuthSignerImp(String consumerKey, String consumerSecret){
		
		Api api = getDefaultApi();
		this.service = api.createService(new OAuthConfig(consumerKey, consumerSecret));
	}
	
	public void sign(OAuthRequest request, String accessKey, String accessSecret) {
		
		Token accessToken = new Token(accessKey, accessSecret);
		service.signRequest(accessToken, request);
	}
	
	private Api getDefaultApi(){
		
		return new DefaultApi10a(){
			@Override
			public String getRequestTokenEndpoint() {
				return null;
			}
			@Override
			public String getAccessTokenEndpoint() {
				return null;
			}
			@Override
			public String getAuthorizationUrl(Token requestToken) {
				return null;
			}};
	}
}
